<template>
  <DataList :name="name" :cate="cate" :single="true" :cols="cols" />
</template>
<script>
import DataList from "@/components/DataList";
import { getUser } from "@/utils/auth";
import { addZdjzmj, deleteZdjzmj, updateZdjzmj, getZdjzmj } from "@/api/占地建筑面积.js";
export default {
  components: {
    DataList
  },
  data() {
    return {
      cate: "A3-1占地、建筑面积",
      name:'3.1 占地、建筑面积',
      cols: [
        { label: "占地面积", prop: "占地建筑面积_占地面积",
        data:[
          {label:"合计",prop:"ZDMJ_HJ"},
          {label:"其中：绿化用地面积",prop:"ZDMJ_LH"}
        ] },
        { label: "校舍总建筑面积", prop: "ZJZMJ" },
        { label: "其中", prop: "校舍总建筑面积_其中",
        data:[
          {label: "学校产权校舍建筑面积", prop: "其中_学校产权校舍建筑面积",
          data:[
            { label: "合计", prop: "XXCQXSJZMJ_HJ" },
            { label: "当年新增校舍", prop: "XXCQXSJZMJ_DNXZXS" }
          ]},
          { label: "非学校产权校舍建筑面积", prop: "FXXCQXSJZMJ"}
        ] },
        { label: "教学科研及辅助用房", prop: "JXKYYFZYF" },
        { label: "其中", prop: "教学科研及辅助用房_其中",
        data:[
          { label: "教室",prop: "JS"},
          { label: "图书馆",prop: "TSG"},
          { label: "实验室、实习场所",prop: "SYSSXCS"},
          { label: "专用科研用房",prop: "ZYKYYF"},
          { label: "体育馆",prop: "TYG"},
          { label: "会堂",prop: "HT"},
        ] },
        { label: "行政办公用房", prop: "XZBGYF" },
        { label: "生活用房", prop: "SHYF" },
        { label: "其中", prop: "生活用房_其中" ,
        data:[
            { label:'学生宿舍(公寓)',prop:'XSSSGY' },
            { label: "学生食堂", prop: "XSST" },
            { label: "教工宿舍(公寓)", prop: "JGSSGY" },
            { label: "教工食堂", prop: "JGST" },
            { label: "生活福利及附属用房", prop: "SHFLJFZYF" },
        ]},
        
        { label: "教工住宅", prop: "JGZZ" },
        { label: "其他用房", prop: "QTYF" },
        
        
      ]
    };
  },
  methods: {
   
    async fetchData() {
      var user = getUser();
      var datas = await getZdjzmj(user.XXID,user.CJPC);
      return datas;
    },
    onadd(model){
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
      
          console.log(JSON.stringify(temp));
          var model = await addZdjzmj(temp);
          resolve(model);
      })
    },
    
    onupdate(model) {
      //
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
          console.log(JSON.stringify(temp));
          var model = await updateZdjzmj(temp);
          resolve(model);
      })
      //
    },
    ondelete(model) {
       var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
        
         await deleteZdjzmj(temp);
          resolve();
      })
    }
  }
};
</script>
<style>
</style>